package com.fly.util;

import org.apache.commons.lang3.StringUtils;

/**
 * 部门层级
 */
public class LevelUtil {
    // 分隔符
    public final static String SEPARATOR = ".";
    public final static String ROOT = "0";

    // 0.1.2
    public static String calculateLevel(String parentLevel,int parentId){
        if (StringUtils.isBlank(parentLevel)){  // 没有父部门
            return ROOT;
        }else {
            return StringUtils.join(parentLevel,SEPARATOR,parentId);
        }
    }
}
